package com.pw.study

object wordCount {
  def main(args: Array[String]): Unit = {
    val l1 = List("hello world", "hello atguigu", "hello good scala")
    val l2 = l1.flatMap(x => {
      x.split(" ")
    }).map(x=> (x,1)).groupBy(x=> x._1).toList.map(x=> (x._1,x._2.size))

    l2.foreach(println(_))
  }
}
